package com.gemantic.task.config.scheduler;

import org.apache.commons.lang3.BooleanUtils;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

public class JobStartCondition implements Condition {
    @Override
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
        String config = context.getEnvironment().getProperty("jobEnabled");
        boolean enable = BooleanUtils.toBoolean(config);
        return enable;
    }
}
